import axios from "./http.js";
import _ from "lodash";

export function getUserInfo(options) {
  let url = "/mps/public/personal_info";
  const opts = _.merge({}, options || {});

  return axios.get(url, opts);
}

export function getUserData(options) {
  let url = "/bs/user/list";
  const opts = _.merge({}, options || {});

  return axios.get(url, opts);
}

export function getUserInfoEveryOne(options) {
  let url = "/bs/user/getById/";
  const opts = _.merge({}, options || {});
  url += opts.params.userId;
  return axios.get(url, opts);
}
// 获取运营列表
export function getAgentList(config) {
  let url = "/mps/operator/search";
  const opts = _.merge({}, config || {});
  return axios.get(url, opts);
}
// 修改密码
export function updatePassword(data, config) {
  let url = "/auth/modify_password";

  data = data || {};
  return axios.post(url, data, config);
}
// 重置密码-管理员用
export function resetPassword(data, config) {
  let url = "/bs/user/modifyPassword";

  data = data || {};
  return axios.post(url, data, config);
}

/* 个人中心的渠道问题 */
export function getQrcodeList(config) {
  let url = "/bs/qrcode/user/qrCodeList";
  const opts = _.merge({}, config || {});
  return axios.get(url, opts);
}

// 删除二维码
export function deleteQrcode(data, config) {
  let url = "/bs/qrcode/user/deleteQrCode/";

  url += data.id;
  delete data.id;
  return axios.post(url, data, config);
}

// 获取海报和链接
export function getBill(config) {
  let url = "/bs/qrcode/channel/viewPosterByQrCode";
  const opts = _.merge({}, config || {});
  return axios.get(url, opts);
}
// 获取海报-用户中心用
export function getViewPoster(config) {
  let url = "/bs/user/viewPoster";
  const opts = _.merge({}, config || {});
  return axios.get(url, opts);
}

// 获取详情浏览信息
export function getViewRecords(config) {
  let url = "/mps/anchor/viewRecords";
  const opts = _.merge({}, config || {});
  return axios.get(url, opts);
}
// 获取渠道注册邀请码生成的二维码-可以跳到小程序注册渠道商
export function getInvitationCodeQrcode(config) {
  let url = "/bs/user/channelRegisterQrcode";
  const opts = _.merge({}, config || {});
  return axios.get(url, opts);
}
// 获取主播邀请码生成的二维码-可以跳到小程序注册主播
export function getActorInvitationCodeQrcode(config) {
  let url = "/bs/user/anchorRegisterQrcode";
  const opts = _.merge({}, config || {});
  return axios.get(url, opts);
}
// 获取用户所属部门
export function getUserDepList(config) {
  let url = "/bs/user/queryDepartmentHierachy";
  const opts = _.merge({}, config || {});
  return axios.get(url, opts);
}
